<template>
	<view class="header_slot" :style="{'height':height+'rpx','background':background}">

	</view>
</template>

<script>
	import {getSystemInfo,isQianfan,isAndroid} from '@/until/QFH5.js'
	export default{
		props:{
			background:{
				type:String,
				default:'#FF4616',
				// default:"#000"
			}
		},
		data(){
			return{
				height:0,
				isHidden:'auto'
			}
		},
		methods:{
			setPageCss(val){
				let cssData =val
				console.log('qhf5当前获取信息',cssData)
				if(val.webModel==1){
					this.height = cssData.screenHeight-cssData.windowHeight
				}else if(cssData.webModel==2){
					this.height = cssData.screenHeight-cssData.statusBarHeight-cssData.windowHeight
				}else{
					this.height=0
				}
				let _this = this
				uni.getSystemInfo({
					success(res) {
						console.log(res,(750/res.screenWidth)*_this.height)
						let obj = {px:_this.height}
						_this.height = (750/res.screenWidth)*_this.height
						obj.rpx = _this.height
						//(安卓容错会有计算差)
						if(isAndroid){
							// obj.rpx = obj.rpx-3
						}
						_this.$store.dispatch('setNavBarHeight',obj)
					}
				})
				// var rpx = 100/(uni.upx2px(this.height)/100);
				// alert(rpx)
				// this.$store.dispatch('setNavBarHeight',154)
			},
			getHeight(){
				getSystemInfo().then(res=>{
					console.log('执行qhf5',res)
					this.setPageCss(res)
				})
			}
		},
		mounted() {
			if(isQianfan()){
				let _this = this
				// window.QFH5ready = function (){
				// 	_this.getHeight()
				// }
				_this.getHeight()
			}
		},
		// onShow() {

		// 	alert('show')
		// },
		// onHide(){
		// 	alert('show')
		// }

	}
</script>

<style lang="scss">
	.header_slot{
		width: 100%;
		height: 44rpx;
		background-color: #000;
		// border-bottom: 1rpx solid red;
	}
</style>
